<template>
    <div class="hello">
        <x-header >导游</x-header>
        <div style="position: absolute;width: 100%;">
            <cell title="linePop" is-link @click.native="processButton001"> </cell>
            <cell title="tourGuideAdd" is-link @click.native="processButton002"> </cell>
            <cell title="tourGuideRank" is-link @click.native="processButton003"> </cell>
            <cell title="群信息" is-link @click.native="processButton004"> </cell>
        </div>
    </div>
</template>

<script>
    import { Group, Cell, Tabbar, TabbarItem, Swiper, SwiperItem } from '_vux@2.9.3@vux'
    import {api} from '@/api'
    import {os} from '@/hos/os'

    export default {
        components: {
            Group,
            Cell,
            Tabbar,
            TabbarItem,
            Swiper,
            SwiperItem
        },
        name: 'Tourguide',
        data () {
            return {
            }
        },
        methods: {
            processButton001 () {
                api.post('Tourguide/linePop', {}, (data) => {
                    console.log('附近的群', data)
                    alert(JSON.stringify(data))
                }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton002 () {
                api.post('Tourguide/tourGuideAdd', {deviceID: 'Treadmill_00_00f100000006_hnk_sports', time: 5, cal: 6.0, dis: 8.0, step: 333, place: 6, line: 'zhejiang1'}, (data) => {
                    console.log('附近的群', data)
                    alert(JSON.stringify(data))
                }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton003 () {
                // 查询一个比赛信息
                api.post('Tourguide/tourGuideRank', {line: 'zhejiang1'}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton004 () {
                // 查询一个比赛信息
                // api.post('Badminton/groupMember', {group_id: 37}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
                // api.post('Badminton/inviteMeList', {group_id: 37}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
                // api.post('Badminton/inviteHandle', {invite_id:  111, invite_state: 1}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
                api.post('Badminton/home', {pk_id: 72, pk_state: 1, team1_score: 1, team2_score: 2}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton005 () {
                // 添加跑步记录
                api.post('Run/runAdd', {dis: 37, cal: 10, start_time: os.time(), const_time: 10, average_speed: 10, path: '1u13,23,113,25', f_snapshot: 0}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton007 () {
                // 查询运动记录信息
                api.post('Run/runInfo', {run_id: 4}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton006 () {
                api.post('Run/dayRank', {page: 1, page_size: 5}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton008 () {
                api.post('Run/monthRank', {page: 1, page_size: 5}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton009 () {
                api.post('Run/yearRank', {page: 1, page_size: 5}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton010 () {
                api.post('Run/myList', {page: 1, page_size: 5}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
                // api.post('Badminton/inviteHandle', {invite_id: 1, invite_state: -1}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            },
            processButton100 () {
                api.post('Run/myList', {page: 1, page_size: 5}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
                // api.post('Badminton/inviteHandle', {invite_id: 1, invite_state: -1}, (data) => { alert(JSON.stringify(data)) }, (error) => { alert(JSON.stringify(error)) })
            }
        },
        beforeDestroy () {
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    h1, h2 {
        font-weight: normal;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        display: inline-block;
        margin: 0 10px;
    }
    a {
        color: #42b983;
    }
</style>
